(function (doc, win) {
    var docEl = doc.documentElement, //html
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', //事件名称
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            if (clientWidth >= 720) {
                docEl.style.fontSize = '100px';
            }
            else {
                docEl.style.fontSize = 100 * (clientWidth / 720) + 'px';
            }
        };

    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    //doc.addEventListener('DOMContentLoaded', recalc, false);
    recalc();
})(document, window);

var meige_time = 1*60*20;


$(document).ready(function() {
	
	
	/**
	 * 用户持久化
	 * 20分钟请求一次服务器
	 * 保证用户不会因为太久而断线 
	 */
	if(localStorage.getItem("user_chijiuhua_id") != undefined) {
		// 表示正在启动中
		// 获取还剩多少秒
		var times = localStorage.getItem("user_chijiuhua_id");

		if(parseInt(times) > 0) {
			times--;
		}
		
		setInterval(function() {
			if(parseInt(times) > 0) {
				times--;
			}
			localStorage.setItem("user_chijiuhua_id", times);
			if(times == 0) {
				// 请求持久化数据
				itcao.itGetAjaxBigData(localStorage.getItem("url") + "education/platform/user/UserChiJiuHua.do").done(function(result) {
					
				})
				localStorage.setItem("user_chijiuhua_id", meige_time);
				times = meige_time;
				
			}
		}, 1000)
		
		
	}else {
		
		var times = meige_time;
		
		setInterval(function() {
			
			if(parseInt(times) > 0) {
				times--;
			}
			
			localStorage.setItem("user_chijiuhua_id", times);
			
			if(times == 0) {
				// 请求持久化数据
				itcao.itGetAjaxBigData(localStorage.getItem("url") + "education/platform/user/UserChiJiuHua.do").done(function(result) {
					
				})
				localStorage.setItem("user_chijiuhua_id", meige_time);
				times = meige_time;
			}
			
		}, 1000)
		
		
	}
	
	
	
	function change(){
		$(".yphd_m li").each(function(index, element) {
			if($(this).find(".hdlx").text() =="官方活动")
				$(this).find(".hdlx").css("background","#fbb902")
			else{
				$(this).find(".hdlx").css("background","#ec967c")
			}
		});
	}
	change()	

 }) 